#ifndef CENGINE_H_
#define CENGINE_H_

#include "GameObserver.h"
#include "WoodenBall.h"
#include "Line.h"

const TInt KGameNew = -1;
const TInt KGameOver = 0;
const TInt KGamePaused = 1;
const TInt KGameStarted = 2;

class CEngine: public CActive
	{
public:
	static CEngine* Instance();
	static void Destroy();
public:
	void AttachObserver( MGameObserver* aObserver );
	void DetachObserver();
	CBall* GetBall();
	CLine* GetLine();
	TRect GetGameRoom();
	void Initialize();
	void PauseOrResume();
	void Next();

public:
	void RunL();
	void DoCancel();
	TInt RunError( TInt aError );

private:
	CEngine();
	~CEngine();
	void ConstructL();
	TBool GameOver();

private:
	static CEngine* iEngine;
private:
	CBall* iBall;
	CLine* iLine;
	CLine* iLeft, *iRight;
	TInt iGameState;
	MGameObserver* iObserver;
	TInt iSpeedTune;
	TRect iGameRoom;
	};

#endif /* CENGINE_H_ */
